package io;

import org.apache.log4j.Logger;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;

/**
 * Created by nanxin.cnx on 2015/7/29.
 */
public class OutputStreamWriterTest {
    public static Logger logger = Logger.getLogger(OutputStreamWriterTest.class);

    public static void main(String[] args) throws IOException {
        String dir = System.getProperty("user.dir");
        System.out.println(dir);
        File f = new File(dir, "test.txt");
        OutputStreamWriter os = new OutputStreamWriter(new FileOutputStream(f,true),"GBK");   //文件不存在会自动创建
        os.write("test");
        os.close();
    }
}
